package com.nuaa.qianru.controller;

import com.nuaa.qianru.model.Problem;
import com.nuaa.qianru.service.StrategyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class StrategyController {

    @Autowired
    private StrategyService strategyService;


    @GetMapping("/strategiesById")
//    id值为2或者3
    public Problem getStrategy(@RequestParam int id){
        return strategyService.getStrategyById(id);
    }

    @PostMapping("/method")
    public void addMethod(@RequestBody Problem problem){

        strategyService.addMethodById(problem.getMethods(),problem.getId());
    }

}
